<?php
    class FrontController {
        private static
            $controller;
        private
            $responses = array();
        const
            ACTION_EMPTY = 'Действие не установленно.',
            MODEL_EMPTY = 'Модель не установленна.',
            METHOD_NO_EXISTS = 'Метод не существует.';
        private function __construct(){}
        static function getInstance(){
            if (FrontController::$controller == NULL){
                FrontController::$controller = new FrontController;
            }
            return FrontController::$controller;
        }
        function run(){
            $vars['action'] = $_GET['action'];
            $vars['model'] = $_GET['model'];
            if (empty($vars['action'])){
                $this->responses[] = self::ACTION_EMPTY;
            }
            if (empty($vars['action'])){
                $this->responses[] = self::MODEL_EMPTY;
            }
            if (isset($vars['action']) and isset($vars['model'])){
                $name = $vars['model'] . 'Controller';
                $actionController = new $name;
                if (method_exists($name, $vars['action'])){
                    $actionController->$vars['action']();
                } else {
                    $this->responses[] = self::METHOD_NO_EXISTS;
                }
            }
        }
    }   
?>